1 using System.Collections;
2 using
System.Collections.Generic;
3 using
UnityEngine;
4 using
UnityEngine.UI;
5
6 public
class SliderValueScore : MonoBehaviour {
7
8     
public Text sliderText;
9     
public Slider slider;
10
11     
private bool init = false;
12
13     
void Awake() {
14         
int oldScore = PlayerPrefs.GetInt(GameManager.SCORE_MAX,1);
15         sliderText.text = oldScore.ToString();
16         slider.
value = oldScore;
17         init =
true;
18     }
19
20     
public void OnValueChanged() {
21         
int value = ((int)slider.value);
22         sliderText.text =
value.ToString();
23
24         PlayerPrefs.SetInt(GameManager.SCORE_MAX,
value);
25
26         
int maxGame = value * 2 - 1;
27         PlayerPrefs.SetInt(GameManager.GAME_MAX, maxGame);
28
29         
if (init) {
30             GameManager.ResetScores();
31         }
32     }
33 }


Gõ tìm kiếm nhanh...